package com.changgou.feign;

import com.changgou.entity.Result;
import com.changgou.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/** 
* @Author: 少迪
* @Date: Created in 2019-08-09 11:36
* @Description:  
* @Version: 1.0
*/ 

@FeignClient("user")
public interface UserFeign {

    /**
     * 发送短信验证码
     * @param mobile
     * @return
     */
    @GetMapping("/user/send_sms")
    public Result sendSms(@RequestParam("mobile") String mobile);

    /**
     * 用户注册
     * @param user
     * @param smsCode
     * @return
     */
    @PostMapping("/user/add")
    public Result add(@RequestBody User user,@RequestParam("smsCode")  String smsCode);

    /***
     * 根据用户名查询数据
     * @param username
     * @return
     */
    @GetMapping("/user/{username}")
    public Result findById(@PathVariable("username") String username);

    /***
     * 修改用户数据
     * @param user
     * @param username
     * @return
     */
    @PutMapping("/user/{username}")
    public Result update(@RequestBody User user,
                         @PathVariable("username") String username);

    /***
     * 多条件搜索品牌数据
     * @param searchMap
     * @return
     */
    @GetMapping(value = "/user/search" )
    public Result findList(@RequestParam Map searchMap);
}
